

#include "land_graphics.h"

#define LAND_OGL_CORE

#include "init.h"

#ifdef LAND_WINDOWS
#include "ogl_winpc.h"
#endif

static struct {
    LandOgl config;
}gCtx;

static LandBackend backend = { 0 };

static int
init(LandGraphics* config){
#ifdef LAND_WINDOWS
    initOglWinpcContext(config, &gCtx.config);
#endif
    landInitOglStdContext(config, &gCtx.config);
    return 0;
}

static int
dispatch() {
#ifdef LAND_WINDOWS
    return dispatchWinpc();
#endif

    return 0;
}


LAND_OGL_API LandBackend*
landInitOgl(LandOgl* config){
    gCtx.config = *config;
    backend.init = init;
    backend.dispatch = dispatch;
#ifdef LAND_WINDOWS
    backend.window = getWinpcWindowBackend();
#endif
    backend.texture = landGetOglTextureBackend();
    backend.shader = landGetOglShaderBackend();
    backend.draw = landGetOglDrawBackend();
    backend.canvas = landGetOglCanvasBackend();
    backend.vertex = landGetOglVertexBackend();
    backend.std = landGetOglStdBackend();
    return &backend;
}